package redis

import (
	"common_demo/internal/config"
	"context"

	"github.com/redis/go-redis/v9"
)

func NewRedisClient(ctx context.Context, conf *config.RedisConfig) (*redis.Client, error) {
	cli := redis.NewClient(&redis.Options{
		Addr:     config.Config.Redis.Address,
		Password: config.Config.Redis.Password,
		DB:       0,
	})
	_, err := cli.Ping(ctx).Result()
	return cli, err
}
